/*
 * dthttp.cpp
 *
 *  Created on: 2010-11-17
 *      Author: zhzuo
 */

#include "dthttp.h"

DtHttp::DtHttp(const QUrl& u,DtHttpMethod m,QObject* recver,const QByteArray& d){
	this->method=m;
	this->url=new QUrl(u);
	this->data=d;
	this->parent=recver;
	this->nam = new QNetworkAccessManager(parent);
}


DtHttp::~DtHttp(){
	nam->deleteLater();
	//URL->d
}

QNetworkAccessManager * DtHttp::Send(){
    if(this->method==GET)
	{
		nam->get(QNetworkRequest(*this->url));
	}
		else
	{
		nam->post(QNetworkRequest(*this->url),this->data);
	}
	return this->nam;
}

QNetworkAccessManager * DtHttp::GetNam(){
	return this->nam;
}

